package com.kamkor.interviewer.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.Widget;
import com.kamkor.interviewer.client.presenter.MergeInterviewPresenter.Display;
import com.kamkor.interviewer.client.toolbar.RichTextToolbar;

/**
 * A view for final step of interview - merging and editing with rich text.  
 * 
 * @author kamkor
 */
public class MergeInterviewView extends Composite implements Display {
	interface MyUiBinder extends UiBinder<Widget, MergeInterviewView> {}
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);		
	
	@UiField(provided=true)
	RichTextArea mergedInterviewArea;	
	
	@UiField
	Button showHtmlText;	

	@UiField(provided=true)
	final RichTextToolbar toolbar;
	 
	
	public MergeInterviewView() {
		mergedInterviewArea = new RichTextArea();		
		toolbar = new RichTextToolbar(mergedInterviewArea);
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public void setData(String interviewHtml) {
		mergedInterviewArea.setHTML(interviewHtml);	
	}

	@Override
	public RichTextArea getMergedInterviewArea() {
		return mergedInterviewArea;
	}

	@Override
	public Button getShowHtmlText() {		
		return showHtmlText;		
	}

	@Override
	public String getShowHtmlTextTitle() {
		return showHtmlText.getTitle();
	}

	@Override
	public void setShowHtmlTextTitle(String title) {		
		showHtmlText.setTitle(title);
	}
}
